home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Dev / misc / WHDLoad_dev.lha / WHDLoad / Src / imager-examples / Cavitas.islave.s < prev    next >
Encoding:
Text File  |  2001-10-03  |  2.0 KB  |  90 lines

  1.  
  2.         ; Cavitas imager by Codetapper!
  3.  
  4.         incdir    Include:
  5.         include    RawDIC.i
  6.  
  7.         OUTPUT    "Cavitas.islave"
  8.  
  9.         IFND    .passchk
  10.         DOSCMD    "WDate  >T:date"
  11. .passchk
  12.         ENDC
  13.  
  14. ;=====================================================================
  15.  
  16.         SLAVE_HEADER
  17.         dc.b    1            ;Slave version
  18.         dc.b    0            ;Slave flags
  19.         dc.l    DSK_1            ;Pointer to the first disk structure
  20.         dc.l    Text            ;Pointer to the text displayed in the imager window
  21.  
  22.         dc.b    "$VER:"
  23. Text:        dc.b    "Cavitas imager V0.1",10
  24.         dc.b    "by Codetapper/Action "
  25.         INCBIN    "T:date"
  26.         dc.b    0
  27.         cnop    0,4
  28.  
  29. DSK_1        dc.l    0            ;Pointer to next disk structure
  30.         dc.w    1            ;Disk structure version
  31.         dc.w    DFLG_NORESTRICTIONS    ;Disk flags
  32.         dc.l    TL_1            ;List of tracks which contain data
  33.         dc.l    0            ;UNUSED, ALWAYS SET TO 0!
  34.         dc.l    FL_NULL            ;List of files to be saved
  35.         dc.l    0            ;Table of certain tracks with CRC values
  36.         dc.l    0            ;Alternative disk structure, if CRC failed
  37.         dc.l    0            ;Called before a disk is read
  38.         dc.l    _SaveDisk        ;Called after a disk has been read
  39.  
  40. TL_1        TLENTRY 000,159,$1600,SYNC_STD,DMFM_STD
  41.         TLEND
  42.  
  43. ;=====================================================================
  44.  
  45. _SaveDisk    move.l    #2,d0            ;d0 = Track number
  46.         jsr    rawdic_ReadTrack(a5)    ;a1 = Track buffer
  47.  
  48.         lea    _Buffer(pc),a3
  49.         move.l    #($1600/4)-1,d0
  50. _CopyToBuffer    move.l    (a1)+,(a3)+
  51.         dbf    d0,_CopyToBuffer
  52.  
  53.         lea    _Buffer(pc),a3
  54.  
  55. _RipNextFile    lea    ($20,a3),a3
  56.         move.l    (a3),d3            ;d3 = First sector
  57.         move.l    (4,a3),d4        ;d4 = Length (bytes)
  58.         lea    (8,a3),a4        ;a4 = Filename
  59.  
  60.         tst.b    (a4)            ;Check if finished
  61.         beq    _OK
  62.  
  63. _RipNextSector    move.l    d3,d1
  64.         divu.w    #11,d1
  65.         moveq    #0,d0
  66.         move.w    d1,d0            ;d0 = Track number
  67.         jsr    rawdic_ReadTrack(a5)    ;a1 = Track buffer
  68.  
  69.         swap     d1
  70.         mulu    #$200,d1
  71.         add.l    d1,a1            ;a1 = Offset
  72.         move.l    (a1)+,d3        ;d3 = Next sector
  73.         move.l    d4,d0
  74.         cmp.l    #$1fc,d0
  75.         blt    _LastChunk
  76.         move.l    #$1fc,d0
  77. _LastChunk    sub.l    d0,d4
  78.         move.l    a4,a0            ;a0 = Filename
  79.         jsr    rawdic_AppendFile(a5)
  80.  
  81.         tst.l    d4
  82.         beq    _RipNextFile
  83.  
  84.         bra    _RipNextSector
  85.  
  86. _OK        moveq    #IERR_OK,d0
  87.         rts
  88.  
  89. _Buffer        ds.l    $1600/4
  90.